﻿using System;
using System.Collections.Generic;
using System.Text;
using DataAccess;
using System.Data;
using Entity;

namespace BusinessObject
{
    public class GreenLifesBO
    {
        GreenLifesDA glDA = new GreenLifesDA();

        public DataSet getGreenLifes()
        {
            DataSet dt = glDA.getGreenLifes();
            return dt;
        }

        public bool createGreenLifes(string title, string quickTitle, string images, string contents, int status)
        {
            GreenLifes gl = new GreenLifes();
            gl.GreenLifesTitle = title;
            gl.GreenLifesQuickTitle = quickTitle;
            gl.GreenLifesImages = images;
            gl.GreenLifesContents = contents;
            gl.GreenLifesStatus = status;

            if (glDA.CreateGreenLifes(gl))
            {
                return true;
            }
            return false;
        }

        public GreenLifes selectGreenLifesById(int id)
        {
            GreenLifes gl = glDA.getGreenLifesById(id);
            return gl;
        }

        public bool updateGreenLifes(GreenLifes gl)
        {
            if (glDA.UpdateGreenLifes(gl))
            {
                return true;
            }
            return false;
        }

        public bool removeGreenLifes(GreenLifes gl)
        {
            if (glDA.DeleteGreenLifes(gl))
            {
                return true;
            }
            return false;
        }
        //Lay greenlife theo status
        public DataSet getGreenLifeByStatus(int status)
        {
            DataSet dt = glDA.selectGreenLifeByStatus(status);
            return dt;
        }

        //phan trang tien ich
        public DataSet phanTrangGreenLifeByStatus(int currPage, int recodperpage, int Pagesize, int Status)
        {
            DataSet dt = glDA.PhanTrangGreenLifeByStatus(currPage, recodperpage, Pagesize, Status);
            return dt;
        }
        
        //phan trang all
        public DataSet phanTrangGreenLifeAllByStatus(int currPage, int recodperpage, int Pagesize)
        {
            DataSet dt = glDA.PhanTrangGreenLifeAllByStatus(currPage, recodperpage, Pagesize);
            return dt;
        }
        
        //Lay 1 greenlife theo status
        public DataSet getTopGreenLifeByStatus(int status)
        {
            DataSet dt = glDA.selectTopGreenLifeByStatus(status);
            return dt;
        }
    }
}
